
#ifndef GAME_CONTROLLER_H
#define GAME_CONTROLLER_H

// INCLUDES ********************************************************************

#include "EAGLViewController.h"

#include "TextElement.h"

#include "Logger.h"

#include "Singleton.h"

// FORWARD DECLARATIONS ********************************************************

namespace Meteor 
{
    class Scene;
}

// *****************************************************************************

/*******************************************************************************

 TODO: - CONSISTENT EXCEPTIONS !!!
       - datatypes to be put where they belong ( if only serving a special
         purpose)
 
       - scene transitions ( fading?)
       
       - particle system
       - ( tilemaps? is this overhead?)
       - memory management - take ownership?
       - overall include file
       - use auto pointers ?
 
*******************************************************************************/

// *****************************************************************************

//! GameController
//!
// *****************************************************************************

namespace Meteor
{
    class GameController : public Singleton<GameController>
    {
        friend class Singleton<GameController>;
        
        public:
            //! runs scene
            void RunScene( Scene* scene);
            
            void DisplayFPS( const bool displayFPS);
    
            void Pause();
        
            void Resume();
            
            //! the gamecontroller is the main instance that calls these
            //! functions on every object to be displayed
            void Update();
            
            void Draw();
            
            EAGLViewController* ViewController();

        private:
            //! this is only called once through the singleton interface
            GameController();
            
            //! prevent copies
            GameController( const GameController&);
            
            const GameController& operator=( const GameController&);
        
            ~GameController();
        
            void FadeSceneIn( Scene* scene);
        
            //! the scene that is currently displayed
            Scene* mCurrentScene;
        
            //! while in development, this can be used to check the fps
            TextElement mFPSLabel;
        
            EAGLViewController* mViewController;
        
            bool mPaused;
        
    }; // end of class GameController
           
} // end of namespace Meteor


#endif // GAME_CONTROLLER_H

